/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aaron.platform.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 订单信息
 * 因合同可以签订多个站点任务，每个站点任务必须做一个订单，故一个订单应该对应一个任务
 * @author chenzhuohua
 */
@Entity
@Table(name = "fgys_order_info")
@SequenceGenerator(name="FGYS_ORDERINFO_GENERATOR", sequenceName="FGYS_ORDERINFO_GENERATOR", allocationSize = 1)
@NamedQueries({
    @NamedQuery(name = "FgysOrderInfo.findAll", query = "SELECT f FROM FgysOrderInfo f")})
public class FgysOrderInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="FGYS_ORDERINFO_GENERATOR")
    @Column(name = "order_id")
    private Integer orderId;

    /** 订单号 */
    @Column(name = "order_no")
    private String orderNo;

    /** 订单行号，若一条订单有多行，则必须对应有多行订单信息对象 */
    @Column(name = "order_line_no")
    private int orderLineNo;

    /** 订单类型:1-覆盖延伸集成费;2-直放站前期施工费;3-桥架建设费;4-电力工程款;5-征地费;6-其他 */
    @Column(name = "order_type")
    private int orderType;

    /** 需求范围（TD/GSM/WLAN） */
    @Column(name = "requirement_type")
    private int requireType;

    /** 订单价 */
    @Column(name = "order_value")
    private float orderValue;
    
    /** 结算价（送审价） */
    @Column(name = "settle_value")
    private float settleValue;

    /** 是否需要审计 */
    @Column(name = "is_audit_required")
    private boolean auditRequired;
    
    /** 送审日期 */
    @Column(name = "to_audit_date")
    @Temporal(TemporalType.DATE)
    private Date toAuditDate;

    /** 审计编号 */
    @Column(name = "audited_no")
    private String auditNo;

    /** 审计价 */
    @Column(name = "audited_value")
    private float auditValue;

    /** 审计日期 */
    @Column(name = "audited_date")
    @Temporal(TemporalType.DATE)
    private Date auditDate;

    /** 付款金额（是一个累计值）*/
    @Column(name = "payment_value")
    private float paymentValue;

    /** 订单状态（未流转/审批中/履行中/付款完成）*/
    @Column(name = "order_status")
    private int orderStatus;

    /** 转资日期 */
    @Column(name = "asseted_date")
    @Temporal(TemporalType.DATE)
    private Date assetDate;

    /** 对应的合同情况 */
    @JoinColumn(name = "ctc_id", referencedColumnName = "ctc_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysContract ctcInfo;

    /** 对应的逻辑站点信息 */
    @JoinColumn(name = "log_site_id", referencedColumnName = "site_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysLogicalSite logSiteInfo;

    /** 所属的项目信息 */
    @JoinColumn(name = "project_id", referencedColumnName = "project_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysProject projectInfo;

    /** 订单对应的单位信息 */
    @JoinColumn(name = "enterprise_id", referencedColumnName = "enterprise_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysEnterprise enterpriseInfo;

    /** 该订单下所有的付款情况表 */
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orderInfo", fetch = FetchType.LAZY)
    private List<FgysPayment> fgysPaymentList;

    public FgysOrderInfo() {
    }

    public FgysOrderInfo(Integer orderId) {
        this.orderId = orderId;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public int getOrderLineNo() {
        return orderLineNo;
    }

    public void setOrderLineNo(int orderLineNo) {
        this.orderLineNo = orderLineNo;
    }
    
    
    public Date getAuditDate() {
        return auditDate;
    }

    public void setAuditDate(Date auditDate) {
        this.auditDate = auditDate;
    }

    public float getAuditValue() {
        return auditValue;
    }

    public void setAuditValue(float auditValue) {
        this.auditValue = auditValue;
    }

    public float getOrderValue() {
        return orderValue;
    }

    public void setOrderValue(float orderValue) {
        this.orderValue = orderValue;
    }

    public float getPaymentValue() {
        return paymentValue;
    }

    public void setPaymentValue(float paymentValue) {
        this.paymentValue = paymentValue;
    }

    public float getSettleValue() {
        return settleValue;
    }

    public void setSettleValue(float settleValue) {
        this.settleValue = settleValue;
    }

    public FgysContract getCtcInfo() {
        return ctcInfo;
    }

    public void setCtcInfo(FgysContract ctcInfo) {
        this.ctcInfo = ctcInfo;
    }

    public FgysLogicalSite getLogSiteInfo() {
        return logSiteInfo;
    }

    public void setLogSiteInfo(FgysLogicalSite logSiteInfo) {
        this.logSiteInfo = logSiteInfo;
    }

    public FgysProject getProjectInfo() {
        return projectInfo;
    }

    public void setProjectInfo(FgysProject projectInfo) {
        this.projectInfo = projectInfo;
    }

    public List<FgysPayment> getFgysPaymentList() {
        return fgysPaymentList;
    }

    public void setFgysPaymentList(List<FgysPayment> fgysPaymentList) {
        this.fgysPaymentList = fgysPaymentList;
    }

    public Date getAssetDate() {
        return assetDate;
    }

    public void setAssetDate(Date assetDate) {
        this.assetDate = assetDate;
    }

    public String getAuditNo() {
        return auditNo;
    }

    public void setAuditNo(String auditNo) {
        this.auditNo = auditNo;
    }

    public boolean isAuditRequired() {
        return auditRequired;
    }

    public void setAuditRequired(boolean auditRequired) {
        this.auditRequired = auditRequired;
    }

    public FgysEnterprise getEnterpriseInfo() {
        return enterpriseInfo;
    }

    public void setEnterpriseInfo(FgysEnterprise enterpriseInfo) {
        this.enterpriseInfo = enterpriseInfo;
    }

    public int getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(int orderStatus) {
        this.orderStatus = orderStatus;
    }

    public int getOrderType() {
        return orderType;
    }

    public void setOrderType(int orderType) {
        this.orderType = orderType;
    }

    public int getRequireType() {
        return requireType;
    }

    public void setRequireType(int requireType) {
        this.requireType = requireType;
    }

    public Date getToAuditDate() {
        return toAuditDate;
    }

    public void setToAuditDate(Date toAuditDate) {
        this.toAuditDate = toAuditDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderId != null ? orderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FgysOrderInfo)) {
            return false;
        }
        FgysOrderInfo other = (FgysOrderInfo) object;
        if ((this.orderId == null && other.orderId != null) || (this.orderId != null && !this.orderId.equals(other.orderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aaron.platform.entity.FgysOrderInfo[orderId=" + orderId + "]";
    }
}
